<% title "Packages that #{@user} depends on the most - Libraries.io" %>

<h1>
  <%= image_tag @user.avatar_url(120), width: 60, height: 60, alt: @user %>
  Packages that <%= link_to @user, admin_organisation_path(@user.to_param) %> depends on the most
</h1>
<hr>
<div class="row">
  <div class="col-md-8">
    <% @projects.each do |project| %>
      <%= render partial: 'project', object: project %>
    <% end %>
    <%= will_paginate @projects %>
  </div>
  <div class="col-md-4">
    <div class='row'>
      <% if @platforms.any? %>
        <div class='col-md-12 facets'>
          <h4>Filter by Package Manager</h4>
          <ul class='filter'>
            <% @platforms.each do |platform| %>
              <li class='<%= 'active' if platform[0].downcase == params[:platform].try(:downcase) %>'>
                <% if platform[0].downcase == params[:platform].try(:downcase) %>
                  <%= link_to platform_name(platform[0]), admin_organisation_dependencies_path(platforms: nil, license: params[:license]) %>
                <% else %>
                  <%= link_to platform_name(platform[0]), admin_organisation_dependencies_path(platforms: platform_name(platform[0]), license: params[:license]) %>
                  <small><%= pluralize number_to_human(platform[1]), 'packages' %></small>
                <% end %>
              </li>
            <% end %>
            <% if @platform && !@platforms.map{|l| l[0].downcase }.include?(@platform.name.downcase) %>
              <li class='active'>
                <%= link_to platform_name(@platform.name), admin_organisation_dependencies_path(platforms: nil, license: params[:license]) %>
              </li>
            <% end %>
          </ul>
        </div>
      <% end %>
    </div>
  </div>
</div>
